/*
moxl - Modular XML Library
Copyright (c) 2007, Malcolm Sparks

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
package moxl.relaxng.simplification.normalization.names;

import moxl.dom.mutable.MutableElement;


/**
 * From the Relax NG book :- This third sequence of steps performs the normalization of name classes:
 * <ul>
 * <li>The name attribute of the element and attribute patterns is replaced by the name element, a name class that matches only a single name.</li>
 * <li>ns attributes are transferred through inheritance to the elements that need them; name, nsName, and value patterns need this attribute to support QName
 * datatypes reliably. (Note that the ns attribute behaves like the default namespace in XML and isn't passed to attributes, which, by default, have no
 * namespace URI.)</li>
 * <li> The QName (qualified name) used in name elements is replaced by their local part. The ns attribute of these elements is replaced by the namespace URI
 * defined for their prefix.</li>
 * </ul>
 */
public class NameClassNormalizer
{
	public MutableElement transform(MutableElement grammarElement)
	{
		grammarElement.accept(new NameClassNormalizingVisitor());
		return grammarElement;
	}

}
